package com.hspedu.homework.homework08;

/**
 * @Author Stringzhua
 * @Date 2024/3/3 18:32
 * description:
 */
public class homework08 {
    public static void main(String[] args) {
        //测试:CheckingAccount账户
//        CheckingAccount checkingAccount = new CheckingAccount(1000);
//        checkingAccount.deposit(10);//1010-1=1009 存钱
//        checkingAccount.withdram(9);//取钱 1000-1=999
//        System.out.println(checkingAccount.getBalance());

        //测试SavingAccount账户
        SavingAccount savingAccount = new SavingAccount(1000);
        savingAccount.deposit(100);//存款
        savingAccount.deposit(100);//存款
        savingAccount.deposit(100);//存款
        System.out.println(savingAccount.getBalance());//1300
        savingAccount.deposit(100);//存款
        System.out.println(savingAccount.getBalance());//1399

        //月初,定时器自动调用一下计算利息的方法
        savingAccount.earnMonthlyInterest();//1%利率
        //1399+13.99
        System.out.println("savingAccount = " + savingAccount.getBalance());//1399+13.99=1412.99
        savingAccount.withdram(100);//免手续费
        System.out.println("savingAccount = " + savingAccount.getBalance());//1412.99-100 1312.99
        savingAccount.withdram(100);//免手续费
        savingAccount.withdram(100);//免手续费
        System.out.println("savingAccount = " + savingAccount.getBalance());//1412.99-200=1112.99
        savingAccount.deposit(100);//存款-->扣手续费
        System.out.println("savingAccount = " + savingAccount.getBalance());//1112.99+100=1212.99-1= 1211.99
    }
}
